ActionController::Routing::Routes.draw do |map|

  map.logout '/logout', :controller => 'sessions', :action => 'destroy'
  map.login '/login', :controller => 'sessions', :action => 'new'
  map.register '/register', :controller => 'users', :action => 'create'
  map.signup '/signup', :controller => 'users', :action => 'new'
  map.connect '/activate/:activation_code', :controller=>'users', :action=>'activate'
  
  map.resources :users, :member=>{:options=>:get, :save_options=>:post, :welcome=>:get, :delete=>:get, :deactivate=>:post, :editall=>:get, :edit_admin=>:post}, :collection=>{:tag=>:get} do |user|
  	user.resources :features
  	user.resources :posts, :collection=>{:editall=>:get}, :member=>{:preview=>:get}
  	user.resources :avatars
  end
  
  map.resource :session
  map.resource :search
  
	map.resources :events, :collection => {:list => :get, :save_list=>:post}
	map.resources :categories, :has_many=>[:articles]
	map.resources :articles, :collection=>{:tag=>:get}, :member=>{:destroy_image=>:post}
  map.resources :comments
  map.resources :pages
	map.resources :rss_channels
  map.resources :posts, :collection=>{:tag=>:get}
  map.resources :communities, :has_many=>[:posts], :member=>{:join=>:get}
  
  map.root :controller => "welcome"

  # For theme_support
  map.theme_images "/themes/:theme/images/:filename", :controller=>'theme', :action=>'images'
  map.theme_stylesheets "/themes/:theme/stylesheets/:filename", :controller=>'theme', :action=>'stylesheets'
  map.theme_javascript "/themes/:theme/javascript/:filename", :controller=>'theme', :action=>'javascript'
  map.connect "/themes/*whatever", :controller=>'theme', :action=>'error'
  
  # For simple_captcha
  map.simple_captcha '/simple_captcha/:action', :controller => 'simple_captcha'

  # Install the default routes as the lowest priority.
  # Note: These default routes make all actions in every controller accessible via GET requests. You should
  # consider removing the them or commenting them out if you're using named routes and resources.
  map.connect ':controller/:action/:id'
  map.connect ':controller/:action/:id.:format'
  
  #map.connect '*path', :controller => 'users', :action => 'show', :conditions => { :foreign_domain => true }
end
